In a mass storage device, consider the general problem of allocating and deallocating memory areas, e.g. data files, of different sizes from the heap of available/used storage while maintaining zero fragmentation. By the term heap we mean the parts of the mass storage which is in use and occupied with data files. In general, allocating a contiguous memory area of size s blocks is straightforward—we simply let the heap grow by s blocks. Deallocation is however not so straightforward. Typically, we end up with a hole somewhere in the middle of the heap and a substantial reorganization effort is required to fill the hole. An alternative would be to relax the requirement that memory areas need to be contiguous. It will then be easier to create patches for the holes but it will be nearly impossible to use the memory areas for storing data structures etc.
Thus, there is a need of a memory management algorithm for a mass storage device which is something in between these two extremes.